package com.itic.mall.mobile.oss;


import java.io.File;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.itic.mall.mobile.base.BaseMobileInterface;
/*import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.model.PutObjectRequest;
import com.qcloud.cos.region.Region;*/


@Controller
@RequestMapping(value="/mobile/tencentoss")
public class TencentOssInterface
     extends BaseMobileInterface {/*
	
	
    *//**
     * 
     * @Title: uploadFile
     * @Description:上传文件
    
    @RequestMapping(value = "/uploadFile")   
	@ResponseBody
    public String uploadFile() {
    	String url = "https://xuxiaobao-1255802096.cos.ap-beijing.myqcloud.com";
    	// 1 初始化用户身份信息(secretId, secretKey)https://console.cloud.tencent.com/cam/capi
    	COSCredentials cred = new BasicCOSCredentials("AKIDlQuCJEVYwBG9rOvtvnUzJROEsLdkcOwJ", "Vq0zmPRHwQjrnX6UibYKvNejeOwJUUJx");
    	// 2 设置bucket的区域, COS地域的简称请参照 https://console.cloud.tencent.com/cos5/bucket
    	ClientConfig clientConfig = new ClientConfig(new Region("ap-beijing"));
    	// 3 生成cos客户端
    	COSClient cosclient = new COSClient(cred, clientConfig);
        //https://console.cloud.tencent.com/cos5/bucket
        String bucketName = "xuxiaobao-1255802096";

	     // 简单文件上传, 最大支持 5 GB, 适用于小文件上传, 建议 20 M 以下的文件使用该接口
	     // 大文件上传请参照 API 文档高级 API 上传
	     File localFile = new File("C://Users/Administrator/Desktop/ftp/108108.png");
	     // 指定要上传到 COS 上的路径
	     String key = "/108108.png";
	     PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, localFile);
	     
	     cosclient.putObject(putObjectRequest);
	     
	     // 关闭客户端(关闭后台线程)//NoSuchBucket; Request ID: NWE1YzM5OTRfZDRiMDM1MGFfMjU1NV8yMzg2NDc=
	     cosclient.shutdown();
	     
         return url += key;
    }
 *//*
	
	@RequestMapping(value = "/uploadFile")   
	@ResponseBody
    public String uploadFile() {
    	String url = "https://uhuijia-1254600872.cos.ap-beijing.myqcloud.com";
    	// 1 初始化用户身份信息(secretId, secretKey)https://console.cloud.tencent.com/cam/capi
    	COSCredentials cred = new BasicCOSCredentials("AKID2sTQ9dgqeDXbS74idLo0wc1A2dx1eWyA", "5wXsxlJabLp43mFTR9cqoWy94j8G9pFQ");
    	// 2 设置bucket的区域, COS地域的简称请参照 https://console.cloud.tencent.com/cos5/bucket
    	ClientConfig clientConfig = new ClientConfig(new Region("ap-beijing"));
    	// 3 生成cos客户端
    	COSClient cosclient = new COSClient(cred, clientConfig);
        //https://console.cloud.tencent.com/cos5/bucket
        String bucketName = "uhuijia-1254600872";

	     // 简单文件上传, 最大支持 5 GB, 适用于小文件上传, 建议 20 M 以下的文件使用该接口
	     // 大文件上传请参照 API 文档高级 API 上传
	     File localFile = new File("C://Users/Administrator/Desktop/ftp/108108.png");
	     // 指定要上传到 COS 上的路径
	     String key = "/000.png";
	     PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, localFile);
	     
	     cosclient.putObject(putObjectRequest);
	     
	     // 关闭客户端(关闭后台线程)//NoSuchBucket; Request ID: NWE1YzM5OTRfZDRiMDM1MGFfMjU1NV8yMzg2NDc=
	     cosclient.shutdown();
	     
         return url += key;
    }
*/}